/*
** move_map.c for  in /home/renard/Dropbox/epitech/dev/projets/systemunix/zappy/zappy-2015-2014s-renard_g/serv-src
**
** Made by guillaume renard
** Login   <renard_g@epitech.net>
**
** Started on  Fri Jun 15 10:22:46 2012 guillaume renard
** Last update Thu Jul 19 17:55:42 2012 pierrick druart
*/

#include	"server.h"
#include	"move_map.h"

t_inventory	move_map_n(t_inventory **map, t_mov *m, int my, int mx)
{
  int		movX;
  int		movY;

  movY = m->y - my;
  if (movY < 0)
    movY = m->sizeY + (movY);
  else if (movY > 0)
    movY %= m->sizeY;
  movX = m->x + mx;
  if (movX < 0)
    movX = m->sizeX + (movX);
  else if (movX > 0)
    movX %= m->sizeX;
  m->movY = movY;
  m->movX = movX;
  return (map[movY][movX]);
}
